package Top200;

/**
 * @author zhangmin
 * @create 2022-02-25 12:10
 */
public class removeDuplicates80 {
    public int removeDuplicates(int[] nums) {
        int n=nums.length;
        if (n<=2) return nums.length;
        int index=2;
        for (int i = 2; i < nums.length; i++) {
            if (nums[i]==nums[index-2]) continue;
            nums[index]=nums[i];
            index++;
        }
        return index;
    }
}
